home *** CD-ROM | disk | FTP | other *** search
/ Visual Basic Source Code / Visual Basic Source Code.iso / vbsource / progre2a / progress.ctl < prev    next >
Encoding:
Visual Basic user-defined control file  |  1999-10-13  |  3.0 KB  |  99 lines

  1. VERSION 5.00
  2. Begin VB.UserControl Progress 
  3.    ClientHeight    =   1080
  4.    ClientLeft      =   0
  5.    ClientTop       =   0
  6.    ClientWidth     =   4665
  7.    ScaleHeight     =   1080
  8.    ScaleWidth      =   4665
  9.    Begin VB.PictureBox PICBar 
  10.       Height          =   675
  11.       Left            =   180
  12.       ScaleHeight     =   615
  13.       ScaleWidth      =   3915
  14.       TabIndex        =   0
  15.       Top             =   180
  16.       Width           =   3975
  17.       Begin VB.PictureBox PICProg 
  18.          Appearance      =   0  'Flat
  19.          BackColor       =   &H00FF0000&
  20.          BorderStyle     =   0  'None
  21.          ForeColor       =   &H80000008&
  22.          Height          =   645
  23.          Left            =   0
  24.          Picture         =   "Progress.ctx":0000
  25.          ScaleHeight     =   645
  26.          ScaleWidth      =   1965
  27.          TabIndex        =   1
  28.          Top             =   0
  29.          Width           =   1965
  30.          Begin VB.Label LBLPer 
  31.             Alignment       =   2  'Center
  32.             BackStyle       =   0  'Transparent
  33.             Caption         =   "50%"
  34.             BeginProperty Font 
  35.                Name            =   "MS Sans Serif"
  36.                Size            =   8.25
  37.                Charset         =   0
  38.                Weight          =   700
  39.                Underline       =   0   'False
  40.                Italic          =   0   'False
  41.                Strikethrough   =   0   'False
  42.             EndProperty
  43.             ForeColor       =   &H00FFFFFF&
  44.             Height          =   225
  45.             Left            =   -30
  46.             TabIndex        =   2
  47.             Top             =   210
  48.             Width           =   1965
  49.          End
  50.       End
  51.    End
  52. End
  53. Attribute VB_Name = "Progress"
  54. Attribute VB_GlobalNameSpace = False
  55. Attribute VB_Creatable = True
  56. Attribute VB_PredeclaredId = False
  57. Attribute VB_Exposed = False
  58. Option Explicit
  59. Dim MaxNumber As Integer
  60.  
  61. Private Sub UserControl_Initialize()
  62.     MaxNumber = 100
  63. End Sub
  64.  
  65. Private Sub UserControl_Resize()
  66.     PICBar.Left = 0
  67.     PICBar.Top = 0
  68.     PICBar.Width = UserControl.Width
  69.     PICBar.Height = UserControl.Height
  70.     PICProg.Left = 0
  71.     PICProg.Top = 0
  72.     PICProg.Width = PICBar.Width / 2
  73.     PICProg.Height = PICBar.Height
  74.     LBLPer.Top = (PICBar.Height / 2) - (LBLPer.Height / 2)
  75.     LBLPer.Left = 0
  76.     LBLPer.Width = PICProg.Width
  77. End Sub
  78.  
  79. Public Property Get MaxValue() As Integer
  80.     MaxValue = MaxNumber
  81. End Property
  82.  
  83. Public Property Let MaxValue(ByVal NewMax As Integer)
  84.     MaxNumber = NewMax
  85. End Property
  86.  
  87. Public Function UpdateTo(CurrentValue As Integer)
  88.     If CurrentValue < MaxNumber Then
  89.         PICProg.Width = (CurrentValue / MaxNumber) * PICBar.Width
  90.         LBLPer.Caption = Format((CurrentValue / MaxNumber), "0%")
  91.         LBLPer.Width = PICProg.Width
  92.        Else
  93.         PICProg.Width = PICBar.Width
  94.         LBLPer.Caption = "100%"
  95.         LBLPer.Width = PICProg.Width
  96.     End If
  97.     UserControl.Refresh
  98. End Function
  99.